package com.note7_8;

import java.util.Scanner;

public class Question3 {

	/*
	 * 输入一个字符串，输出他的最长的连续回文子串，回文是指颠倒后和原串相同，比如aaabcba2222,则最长子串是 abcba
	 */
	

	public static boolean judge(String string) {//判断是否为字符串是否为回文
		char temp[] = string.toCharArray();
		int start=0;
		int stop=string.length()-1;
		while(start<stop) {
			if(temp[start]!=temp[stop]) {
				return false;
			}
			stop--;
			start++;
		}
		return true;
	}
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String flag = in.nextLine();
		String max = null;
		int flag0 = 1;
		for(int i=0;i<flag.length()-1;i++) {
			for(int j=i+1;j<=flag.length();j++) {
				String temp = flag.substring(i, j);
				if(judge(temp)) {
					if(flag0 < temp.length()) {
						max=temp;
						flag0 = temp.length();
					}
				}
			}
		}
		System.out.println(flag0);
		System.out.println(max);
	}
}
